#include "converseabstractmessage.h"
#include "converseabstractconversation.h"
#include "account/accountuser.h"


#include <QDebug>


namespace Converse {

AbstractMessage::AbstractMessage(qint64 id,
                 qint64 sendingId,
                 const AbstractConversation &conversation,
                 qint64 createdTime,
                 qint64 receivedTime,
                 int32_t senderId,
                 qint64 receiverId,
                 QObject *parent) :
    QObject(parent),
    m_id(id),
    m_sendingId(sendingId),
    m_conversation(conversation),
    m_createdTime(createdTime),
    m_receivedTime(receivedTime),
    m_senderId(senderId),
    m_receiverId(receiverId)
{
}


QVariant AbstractMessage::toVariant() const
{

    QVariantMap map;
    map.insert("idt", QString("%1").arg(m_sendingId));
    map.insert("to", QString("%1").arg(m_receiverId));
    map.insert("from", QString("%1").arg(m_senderId));
    map.insert("msg", message());
    map.insert("type", type());
    map.insert("extdata", extra());
    return map;
}


int32_t AbstractMessage::senderId() const
{

    return m_senderId;
}


} // namespace Converse
